#define _CRT_SECURE_NO_WARNINGS

int* findDisappearedNumbers(int* nums, int numsSize, int* returnSize) {
    for (int i = 0; i < numsSize; i++)
    {
        int index = (nums[i] - 1) % numsSize;
        nums[index] += numsSize;
    }
    int* ret = (int*)malloc(sizeof(int) * numsSize);
    *returnSize = 0;
    for (int i = 0; i < numsSize; i++)
    {
        if (nums[i] <= numsSize)
        {
            ret[*returnSize] = i + 1;
            (*returnSize)++;
        }
    }
    return ret;
}


int Compare(const void* p1, const void* p2)
{
    return *(int*)p1 - *(int*)p2;
}
int findContentChildren(int* g, int gSize, int* s, int sSize) {
    qsort(g, gSize, sizeof(int), Compare);
    qsort(s, sSize, sizeof(int), Compare);
    int  i = 0;
    int j = 0;
    int count = 0;
    for (; i < gSize; i++)
    {
        while (j < sSize && s[j] < g[i])
        {
            j++;
        }
        if (j == sSize)
        {
            break;
        }
        count++;
        j++;
    }
    return count;

}